using System;
using System.Collections.Generic;
using System.Text;
using Utility;
using Entites;
using DAL;
namespace BUS
{
   public class PhuongThucThanhToanBUS
    {
         
         public static void Insert(PhuongThucThanhToan pttt)
        {
            PhuongThucThanhToanDAL ptttDAL = new PhuongThucThanhToanDAL();
           ptttDAL.Insert(pttt);
        }
        public static void Update(PhuongThucThanhToan pttt)
        {
            PhuongThucThanhToanDAL ptttDAL = new PhuongThucThanhToanDAL();
            ptttDAL.Update(pttt);
        }
        public static void Delete(int iD)
        {
            PhuongThucThanhToanDAL ptttDAL = new PhuongThucThanhToanDAL();
            ptttDAL.Delete(iD);
        }
        public static tbPhuongThucThanhToanCollection Get(string where,
            int pageindex,
            int pagesize,
            string orderby,
            string orderdirection,
            out int total)
        {
            PhuongThucThanhToanDAL ptttDAL = new PhuongThucThanhToanDAL();
            return ptttDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }
        public static tbPhuongThucThanhToanCollection GetAll()
        {
            int total = 0;
            Criteria cri = new Criteria();
            PhuongThucThanhToanDAL ptttDAL = new PhuongThucThanhToanDAL();
            return ptttDAL.Get(cri.Criter, 0, 0, tbPhuongThucThanhToanColumns.MaPTTT.ToString(), OrderDirection.ASC.ToString(), out total);
        }
       public static PhuongThucThanhToan GetByID(int iD)
       {
           int total = 0;
           Criteria cri = new Criteria();
           cri.add(Condition.AND, tbPhuongThucThanhToanColumns.MaPTTT.ToString(), Condition.EQUAL, iD);
           PhuongThucThanhToanDAL ptttDAL = new PhuongThucThanhToanDAL();
           tbPhuongThucThanhToanCollection phuongthucthanhtoancollection = ptttDAL.Get(cri.Criter,
                 0, 0, tbPhuongThucThanhToanColumns.MaPTTT.ToString(), OrderDirection.ASC.ToString(), out total);
           if (phuongthucthanhtoancollection.Count > 0)
               return phuongthucthanhtoancollection[0];
           return null;
       }
      
        public static tbPhuongThucThanhToanCollection GetLimited(int number)
        {
            int total = 0;
            Criteria cri = new Criteria();
            PhuongThucThanhToanDAL ptttDAL = new PhuongThucThanhToanDAL();
            return ptttDAL.Get(cri.Criter, 1, number,
             tbPhuongThucThanhToanColumns.MaPTTT.ToString(), OrderDirection.DESC.ToString(), out total);
        }
        public static tbPhuongThucThanhToanCollection    GetPromotion(int number)
        {
            int total = 0;
            Criteria cri = new Criteria();
            PhuongThucThanhToanDAL ptttDAL = new PhuongThucThanhToanDAL();
            return ptttDAL.Get(cri.Criter, 1, number,
               tbPhuongThucThanhToanColumns.MaPTTT.ToString(), OrderDirection.DESC.ToString(), out total);
        }
    }
    
    
}
